
package java68_8;

public class MotherBoard {
    private String series="华硕磐石-1";

    private CPU cpu;
    private Memory mem;
    //三个USB接口
    private USB u1,u2,u3;

    public void setCPU(CPU cp){
        cpu=cp;
    }
    public void insertMem(Memory memory){
        this.mem=memory;
    }
    public void plug(USB u1){
        this.u1=u1;
    }
    public void plug2(USB u2){
        this.u2=u2;
    }
    public void work(){
        System.out.println(series+"主板通电工作了");
        cpu.calc();
        mem.read();
        mem.store(100);
        if(u1!=null)
            u1.work();

        if(u2!=null)
            u2.work();

        if(u3!=null)
            u3.work();
    }
}
